﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace badmati.Log
{
    public class DbManager
    {
        private string _connectionString;

        public DbManager()
        {
            _connectionString = String.Empty;
        }
        /// <summary>
        /// 连接字符串
        /// </summary>
        public string ConnectionString
        {
            get
            {
                if (string.IsNullOrEmpty(_connectionString))
                {
                    var sb = new SqlConnectionStringBuilder
                    {
                        DataSource = ".",
                        InitialCatalog = "test",
                        IntegratedSecurity = false,
                        MultipleActiveResultSets = true,
                        UserID = "sa",
                        Password = "927912hh"

                    };
                    _connectionString = sb.ToString();
                    return _connectionString;
                }

                return _connectionString;
            }
        }
        public IDbConnection DbConnection => new SqlConnection(ConnectionString);
    }
}
